const express = require('express');
const router = express.Router();

const productRoutes = require('./product.route');
const categoryRoutes = require('./category.route');
const orderRouter = require('./order.route');
const uploadRoutes = require('./upload.route');
const settingsRoutes = require('./settings.route');
const bannerRoutes = require('./banner.route');
const bannerController = require('../../controllers/admin/banner');
const { verifyAdmin } = require('../../middlewares/auth');

// 注册路由
router.use('/products', productRoutes);
router.use('/categories', categoryRoutes);
router.use('/orders', orderRouter);
router.use('/upload', uploadRoutes);
router.use('/settings', settingsRoutes);
router.use('/banners', bannerRoutes);

// 直接添加轮播图排序路由，带验证中间件
router.put('/banners/:id/sort', verifyAdmin, bannerController.updateSort);

module.exports = router; 